{include file="common/_header"}
{include file="common/_header1"}

<body class="layui-anim layui-anim-up">
<div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">报表管理</a>
            <a>
              <cite>商铺订单管理</cite></a>
          </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>

<div class="x-body">

    <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so">
            <div class="layui-input-inline">
                {if $data.isdisplay == true}
                <div class="layui-unselect layui-form-select spf_id" style="display:inline-block;">
                    <input type="text" name="shop_name"  placeholder="请输入商铺名称" value="{$data.get['shop_name']}" autocomplete="off" class="layui-input">
                </div>
                {/if}
                <div class="layui-unselect layui-form-select" style="display:inline-block;">
                    <select name="order_status" class="order_status">
                        <option value="">订单状态</option>
                        {volist name="data.statelist" id="vo"}
                        <option value={$key} {$data.get.order_status == $key?'selected':''}>{$vo}</option>
                        {/volist}
                    </select>
                </div>
                <div class="layui-unselect layui-form-select paystate" style="display:inline-block;">
                    <select name="pay_status" lay-filter="pay_status">
                        <option value="">支付状态</option>
                        {volist name="data.paystatelist" id="vo"}
                        <option value={$key} {$data.get.pay_status == $key?'selected':''}>{$vo}</option>
                        {/volist}
                    </select>
                </div>
                <div class="layui-input-inline">
                    <input type="text" name="time" class="layui-input" id="test1" placeholder="请选择时间" readonly value="{$data.get.time}">
                </div>
                <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
            </div>

        </form>
    </div>

    <table id="tables" class="layui-table">
        <thead>
        <tr>
            {if $data.isdisplay == true}
            <th>商铺名称</th>
            {/if}
            <th>订单号</th>
            <th>订单状态</th>
            <th>支付状态</th>
            <th>购买数量</th>
            <th>订单金额</th>
            <th>购买商品</th>
            <!--            <th>订单总价</th>-->
            <!--            <th>实付金额： (订单金额 - 优惠券金额)+（运费)</th>-->
            <!--            <th>优惠券价格</th>-->
            <!--            <th>运费</th>-->
            <th>收货信息</th>
            <th>日期</th>
            <th>是否已提醒</th>
            <th>发货信息</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="data.data" id="vo"}
        <tr class="table_tr">
            <td>{if $vo.shop_id == 0}总部{else/}{$vo.shop_name}{/if}</td>
            <td>{$vo.orderno}</td>
            <td>{$data['statelist'][$vo['order_status']]}</td>
            <td>{$data['paystatelist'][$vo['pay_status']]}</td>
            <td>{$vo.number}</td>
            <td>
                兑换积分：{$vo.points}<br>
                总运费：{$vo.express_fee}<br>
                支付金额：{$vo.pay_amount}
            </td>
            <td>
                {volist name="vo.children" id="v"}
                {$v.product_name}——{$v.p_s_name}
                {/volist}
            </td>
            <td>
                收货人：{$vo.name}<br>
                联系手机号：{$vo.phone}<br>
                收货地址：{$vo.province_name}{$vo.city_name}{$vo.area_name}{$vo.street_name}{$vo.detail}<br>
            </td>

            <td>下单时间：{$vo.order_time|date="Y-m-d H:i:s"}<br>{if !empty($vo.pay_time)}支付时间：{$vo.pay_time|date="YmdHis"}{/if}</td>
            <td>{if $vo.is_remind == 1}否{else/}是{/if}</td>
            <td>
                {if !empty($vo.tracking_number)}快递单号：{$vo.tracking_number}{/if}<br>
                {if !empty($vo.shiping_time)}发货时间：{$vo.shiping_time|date="Y-m-d H:i:s"}{/if}
            </td>
            <td>
                <ul class="nav navbar-nav" style=" height: 30px; line-height: 10px;">
                    <li class="dropdown" style="height: 100%;">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" style=" height: 100%; line-height: 5px;">
                            操作
                            <b class="caret"></b>
                        </a>
                        <ul class="dropdown-menu">
                            <li><a title="查看详情"  onclick="x_admin_show('订单详情', 'boxshopdetail?order_id={$vo.order_id}', '800', '600')" href="javascript:;">查看详情</a></li>
                            {if $vo.order_status == 2}
                            <li><a title="发货"  onclick="x_admin_show('发货', 'shiping?order_id={$vo.order_id}', '400', '300')" href="javascript:;">发货</a></li>
                            {/if}
                        </ul>
                    </li>
                </ul>
            </td>

        </tr>
        {/volist}
        </tbody>
    </table>
    <div class="page_all">
        {$page|raw}
    </div>
</div>
<script src="/static/admin/lib/layui/layui2.js" charset="utf-8"></script>
<script type="text/javascript">
    layui.use('laydate', function(){
        let laydate = layui.laydate;

        //常规用法
        laydate.render({
            elem: '#test1'
            , range: true
        });

        //国际版
        laydate.render({
            elem: '#test1-1'
            ,lang: 'en'
        });
    });
</script>
<script>
    layui.use("form",function(){
        var form = layui.form;
        form.on('select(spf_id)', function (sub) {
            console.log(sub.value);
            selectedProducts(sub.value,'');
        });
    })
</script>
<script>

    $(function () {
        // 表格选中行的同时选中单选框
        $("#tables tr:gt(0)").click(function () {
            $(this).find(":radio").prop("checked", true);
        });

    });

    //js放到table下，才能检测到tr数组
    var trs = document.getElementById("tables").getElementsByTagName("tr");
    $(function () {
        for (var i = 0; i < trs.length; i++) {
            trs[i].onmousedown = function () {
                mousedownclick(this);
            }
        }
    });

    function mousedownclick(obj) {
        for (var j = 0; j < trs.length; j++) {
            if (trs[j] == obj) {
                if (trs[0] != obj) {
                    trs[j].style.background = '#D0E9C6';
                    // 启用新增和编辑按钮
                    $("#edits").removeAttr("disabled");//启用按钮
                    $('#edits').removeClass('layui-disabled');
                }
            } else {
                trs[j].style.background = '';
            }
        }
    }
</script>
</body>

{include file="common/_bottom"}